# coding: utf8

import math
import numpy as np


def table99():
    """
    print 9*9 multi sqrt table
    """
    table = []
    for i in range(1, 10):
        table.append([i*j for j in range(1, 10) if i >= j])
    return table


def print_table(table, fmt='.4f'):
    for row in table:
        for x in row:
            print(format(x, fmt), end=' ')
        print("")


def table99_sqrt(table):
    """
    print 9*9 multi sqrt table
    """
    sqrt_table = [[math.sqrt(x) for x in row] for row in table]
    print_table(sqrt_table)


def table99_cbrt(table):
    """
    print 9*9 multi cbrt table
    """
    cbrt_table = [np.cbrt(row) for row in table]
    print_table(cbrt_table)


if __name__ == "__main__":
    table = table99()
    print_table(table, fmt='<2d')
    table99_sqrt(table)
    table99_cbrt(table)
